# from pymouse import PyMouse
from pykeyboard import PyKeyboard
import pyperclip
import keyboard as kkk

class KeyboardMouse(object):
  def __init__(this):
    this.ss = 'dd'
  # 全选
  def keyChooseAll(this):
    # this.keyGroup('ctrl','A')
    kkk.press_and_release('ctrl+a')
  # 复制
  def keyCopy(this):
    # this.keyGroup('ctrl','C')
    kkk.press_and_release('ctrl+c')
  # 粘贴
  def keyPaste(this):
    # this.keyGroup('ctrl','V')
    kkk.press_and_release('ctrl+v')
  # 查看源码 (edge浏览器)
  def keyEdgeSource(this):
    # this.keyGroup('ctrl','U')
    kkk.press_and_release('ctrl+u')
  
  # 关闭源码 (edge浏览器)
  def keyEdgeSourceClose(this):
    # this.keyGroup('ctrl','W')
    kkk.press_and_release('ctrl+w')
  
  # 读取 剪贴板文本
  def readClipboardTxt(this):
    return pyperclip.paste()
  # 设置 剪贴板文本
  def writeClipboardTxt(this,txt):
    pyperclip.copy('中文') 
  # 按下组合键 fun=ctrl|alt|shift
  def keyGroup(this,fun,abc):
    if fun == 'alt':
      funKey = this.keyboard.alt_key
    if fun =='shift':
      funKey = this.keyboard.shift_key
    if fun == 'ctrl':
      funKey = this.keyboard.control_key
    this.keyboard.press_key(funKey)

    this.keyboard.tap_key(abc)
    this.keyboard.release_key(funKey)
